<div id="commission-manage-view">
  <div class="page">
    <div class="al-list-container">
      <form class="form-horizontal al-search-container" role="form">
        <div class="form-group">
          <label class="col-sm-1 control-label">公寓</label>
          <div class="col-sm-3" ng-if="apartmentList.length>1">
            <qgy-apartment-item apm-data="search" apm-list="apartmentList"></qgy-apartment-item>
          </div>
          <label class="col-sm-1 control-label">时间段</label>
          <div class="col-sm-2">
            <div class="input-group">
              <input class="form-control" type="text" uib-datepicker-popup="yyyy-MM-dd"
                     ng-model="search.payTimeStart" is-open="enterStart" maxlength="10"
                     close-text="关闭" current-text="今天" clear-text="清空"
                     placeholder=""/>
              <span class="input-group-btn">
                <button type="button" class="btn btn-default" ng-click="enterStart=true">
                  <i class="glyphicon glyphicon-calendar"></i>
                </button>
              </span>
            </div>
          </div>
          <label class="control-label text-center al-fl-lt">&nbsp;&nbsp;~&nbsp;&nbsp;</label>
          <div class="col-sm-2">
            <div class="input-group">
              <input class="form-control" type="text" uib-datepicker-popup="yyyy-MM-dd"
                     ng-model="search.payTimeEnd" is-open="enterEnd" maxlength="10"
                     close-text="关闭" current-text="今天" clear-text="清空"
                     placeholder=""/>
              <span class="input-group-btn">
                <button type="button" class="btn btn-default" ng-click="enterEnd=true">
                  <i class="glyphicon glyphicon-calendar"></i>
                </button>
              </span>
            </div>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-1 control-label">已结佣</label>
          <div class="col-sm-3">
            <nobr>
              <label class="ui-radio">
                <input name="status" ng-value="true" type="radio" ng-model="search.successSettlement">
                <span>是</span>
              </label>
            </nobr>
            <nobr>
              <label class="ui-radio">
                <input name="status" ng-value="false" type="radio" ng-model="search.successSettlement">
                <span>否</span>
              </label>
            </nobr>
          </div>
          <label class="col-sm-1 control-label">业务员</label>
          <div class="col-sm-2">
            <input class="form-control" type="text" placeholder="业务员"
                   ng-model="search.filter"  maxlength="32">
          </div>
          <div class="col-sm-1">
            <button type="button" ng-click="queryData()" class="btn btn-success al-float-right">查询</button>
          </div>
          <div class="col-sm-1">
            <button type="button" ng-click="resetSearch()" class="btn btn-default">重置</button>
          </div>
          <div class="col-sm-2" style="float: right">
            <caption>
              <button class="btn btn-primary"
                      style="float:right"
                      ng-if="!exporting"
                      data-ng-disabled="exporting"
                      ng-confirm-click="确定要导出吗？"
                      ng-click="exportData()">
                导出Excel
              </button>
              <button class="btn btn-primary"
                      style="float:right"
                      ng-if="exporting"
                      disabled>
                正在导出。。
              </button>
            </caption>
          </div>
        </div>
      </form>
      <table ng-table="tableParams"
             class="table  table-bordered table-striped table-condensed al-table-container">
        <thead>
        <tr style="vertical-align: center;text-align: center">
          <td>序号</td>
          <td>姓名</td>
          <td>手机号</td>
          <td>公寓</td>
          <td>房间号</td>
          <td>签约日期</td>
          <td>月租金</td>
          <td>租期</td>
          <td>渠道</td>
          <td>业务员</td>
          <td>佣金</td>
          <td>付款方式</td>
          <td>操作</td>
        </tr>
        </thead>
        <tbody>
        <tr ng-repeat="item in $data">
          <td>{{$index+1}}</td>
          <td>{{item.customerName}}</td>
          <td>{{item.customerPhone}}</td>
          <td>{{item.apartmentName}}</td>
          <td>{{item.houseNo}}</td>
          <td>{{item.signTime|dateTransfer:'YYYY-MM-DD'}}</td>
          <td>{{item.rental}}</td>
          <td>{{item.leaseName}}</td>
          <td>{{item.buzTypeName}}</td>
          <td>{{item.receptionist}}</td>
          <td>{{item.commission}}</td>
          <td>{{item.payWayName}}</td>
          <td>
            <div ng-if="item.successSettlement==true">已结佣</div>
            <button ng-if="item.successSettlement!=true" class="btn btn-success btn-sm"
                    ng-confirm-click="{{'确认房间['+item.houseNo+']的佣金已经结给业务员了吗？'}}"
                    ng-click="confirmCommission(item)">结佣</button>
          </td>
        </tr>
        </tbody>
      </table>
    </div>
  </div>
</div>
